
/****************************************************************************************
*                                                                                      *
*                          Projeto BioInfo - Lincs and CIn / UFPE                      *
*                                    07/10/2014                                        *
*																					   *
****************************************************************************************
* Descricao: Arquivo que contem funcao que executa todos os passos do projeto           *
****************************************************************************************
* Responsaveis: Jefferson Ramos(jrla)													   *
*                                                                                      */
/*                                                                                     *
****************************************************************************************/


#include <bioaplication_sw.h>

int bioaplication_sw::get_id_program() {

	int id_program = 0;

	cout << "Escolha o programa para execucao:\n"
		"1 - Needleman Canonic\n"
		"2 - Needleman Threads\n"
		"3 - Needleman Ocl\n"
		"4 - Generate Bank File\n"
		"5 - Exit" << endl;
	cin >> id_program;

	return id_program;
}


void bioaplication_sw::executar() {

	int id_program;

	fopen_s(&BD_nucleotideos, "../files/BD_out_bin.bin", "rb");
	if (BD_nucleotideos == NULL){// apenas testando se existe o banco, se nao existe cria um banco

		printf("\nAttention: There is no file BD_nucleotideos\n");
		printf("\n\nPress ENTER to create BD Files...\n");
		fflush(stdin);
		getchar();

		run_bank_file();
	}
	else
		fclose(BD_nucleotideos);//se existe apensa fecha

	do{
		id_program = get_id_program();

		if (id_program == 1){
			run_canonic();
		}
		else if (id_program == 2){
			run_threads();
		}
		else if (id_program == 3){
			run_ocl();
		}
		else if (id_program == 4){
			run_bank_file();
		}

	} while (id_program != 5);

	bioinfo_canonic->~Canonic();
	bioinfo_BD->~files_BD();
	bioinfo_threads->~Threads();

	printf("\n\nPress ENTER to exit...");
	fflush(stdin);
	getchar();

	

	return;
}


